﻿using System;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using BaseLinQ.DataContex;
using DevExpress.XtraReports.UI;
using Solution.AppCode;

namespace Solutions.Admin.Report
{
    public partial class rp_baocaonguoidung : DevExpress.XtraReports.UI.XtraReport
    {
        string _conn = ConfigurationSettings.AppSettings["ConnectString"];
        RBACDataContext db = null;
        public rp_baocaonguoidung()
        {
            InitializeComponent();
        }
        public void BindData(DataTable data)
        {
            xrt_ngayketxuat.Text = "Ngày " + DateTime.Now.Day + " tháng "+" " + DateTime.Now.Month + " năm "+ DateTime.Now.Year;
            db = new RBACDataContext(_conn);
            xrL_ChiNhanh.Text="Chi nhánh:"+" "+(from m in db.tbl_Donvis
                                           where m.pk_iDonViID == UtilsData.GetUserDepartment()
                                           select m.sTenDonVi).FirstOrDefault();
            DataSource = data;
           xr_hoten.DataBindings.Add("Text", DataSource, "sHoTen");
            xr_tendangnhap.DataBindings.Add("Text", DataSource, "sTenDangNhap");
            xr_donvi.DataBindings.Add("Text", DataSource, "sTenDonVi");
            xr_sodienthoai.DataBindings.Add("Text", DataSource, "sDienThoai");
            xr_email.DataBindings.Add("Text", DataSource, "sEmail");
            xr_ghichu.DataBindings.Add("Text", DataSource, "sGhiChu");
           
        }
        int STT = 1;
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            xr_stt.Text = STT.ToString();
            STT++;
        }
    }
}
